package com.roomaja.roomaja.tool;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.roomaja.roomaja.entity.WenKuEntity;

import java.util.List;

/**
 * Created by lzc on 2018/5/7.
 */
public class StringUtils {

    public static JSONArray wenkuEntityList2Json(List<WenKuEntity> list){
        JSONArray json = new JSONArray();
        for(WenKuEntity wenKuEntity : list){
            JSONObject jo = new JSONObject();
            jo.put("doc_id", wenKuEntity.getDocId());
            jo.put("doc_type", wenKuEntity.getDocType());
            jo.put("doc_title", wenKuEntity.getDocTitle());
            jo.put("doc_author", wenKuEntity.getDocAuthor());
            jo.put("doc_size", wenKuEntity.getDocSize());
            jo.put("downloads", wenKuEntity.getDownloads());

            json.add(json);
        }
        return json;
    }
}
